

package bis;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

public class FLOrderMxMgr extends FLBaseMgr {

    private ArrayList GetDate() {
        ArrayList list = new ArrayList();
        ResultSet rs = super.Query();
        try {
            while (rs.next()) {
                FLOrder flo = new FLOrder(0, rs.getDouble(1), rs.getDouble(2), rs.getDouble(3), rs.getDouble(4), rs.getDouble(5), rs.getString(6));
                list.add(flo);
            }
        } catch (SQLException ex) {
            Logger.getLogger(FLOrderMgr.class.getName()).log(Level.SEVERE, null, ex);
        }

        return list;
    }

    public ArrayList GetDateById(String id) {
        QueryStr = "select * from tblOrderMx where orderId='" + id + "'";
        return GetDate();
    }

    public ArrayList GetAllDate() {
        QueryStr = "select * from tblOrderMx";
        return GetDate();
    }

    public void flcdelete(String id) {
        this.bm = id;
        this.BaseDelete();

    }

    public boolean isInsert(FLOrderMx flom) {
        InsertStr = "insert into tblOrderMx(orderId,bookId,xsj,xsrq) values(" + flom.orderId + "," + flom.bookId + "," + flom.xsj + ",'" + flom.xsrq+ "')";
        return Insert();
    }

    public void setUpdate(FLOrderMx flom) {
        QueryStr = "select * from tblOrderMx where orderId='" + flom.orderId+ "'";
        super.UpdateStr = "update tblOrderMx set Yhbm=" + flom.orderId+ ",bookId=" + flom.bookId + ",xsj=" +flom.xsrq +",xsrq='" + flom.xsrq+"'";
        super.BaseUpdate();
    }

    @Override
    public void BaseDelete() {
        QueryStr = "select * from tblOrderMx where BookId=" + bm;
        UpdateStr = "delete from tblOrderMx where BookId=" + bm;
        super.BaseDelete();
    }

    public static void main(String[] args) {
        java.util.Date nowdate = new java.util.Date();
        java.text.SimpleDateFormat ss = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String orderdate = ss.format(nowdate);
        FLOrderMx  c = new FLOrderMx();
      c.setBookId(8);
      c.setOrderId(3);
      c.setXsj(100);
      c.setXsrq(orderdate);
        FLOrderMxMgr  c2 = new FLOrderMxMgr ();
        c2.isInsert(c);
    }
}

